package com.cg.controller;

import com.cg.entity.User;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * <p>Title: DemoController </p>
 * <p>Description: TODO </p>
 * Package: com.cg.controller
 * Copyright: Copyright(c) 2020 Hjfruit All Rights Reserved
 * Company: Hjfruit
 * Software: pitaya
 * Date: 2021/5/19 10:57
 *
 * @author cheyinbo
 * @version 1.0.0.0
 */
@RestController
public class DemoController extends BaseController {


    @GetMapping("/{dateStr}")
    public void parse(@PathVariable("dateStr") Date dateStr){
        System.out.println(dateStr);
    }

    @GetMapping("/")        //若未使用string和date的转化,如:InitBinder初始化绑定和注解@JsonFormatter的时间格式化操作,则报非法转化异常
    public void getParse(User user){
        System.out.println(user);
    }

    @PostMapping("/")       //不做任何string和date的转化,user上的birthday字段可以正常封装并转换
    public void postParse(User user){
        System.out.println(user);
    }


}
